import request from "./request.js";

/**
 * 登录接口
 * @param {*} params 
 * @returns 
 */
export function loginPost(params) {
    return request({
        url: '/user/login',
        method: 'post',
        data: params,
    })
}

/**
 * 验证码接口
 * @param {邮箱} data 
 * @returns 
 */
export function GetCode(data = {}){
    return request({
        method: "post",
        url: "/user/requestForCode",
        data
    })
}

/**
 * 注册
 * @param {*} data 
 * @returns 
 */
export function Register(data = {}){
    return request({
        method: "post",
        url: "/user/register",
        data
    })
}


/**
 * 表格接口
 * @param {*} params 
 * @returns 
 */
export function TableData(params={}) {
    return request({
        url: params.url,
        method: params.method,
        data: params.data,
    })
}

/**
 * 
 * @param { method } String 请求类型 
 * @param { url } String 请求地址 
 * @param { data } Object 请求参数 
 * @description BasisTable组件公共接口 
 */
export function CommonApi(params = {}){
    return request({
        method: params.method,
        url: params.url,
        data: params.data
    })
}


/**
 * 添加项目信息
 * @param {data} data 
 * @returns 
 */
export function InfoCreate(data = {}){
    return request({
        method: "post",
        url: "/projectmanage/addProject",
        data
    })
} 

/**
 * 更新（编辑）项目信息
 * @param {data} data 
 * @returns 
 */
export function InfoEdit(data = {}){
    return request({
        method: "post",
        url: "/projectmanage/updateInfo",
        data
    })
}
/**
 * 获取表格项目行详情
 * @param {userid,projectid} data 
 * @returns 
 */
export function GetDetailed(data = {}){
    return request({
        method: "get",
        url: "/projectmanage/getDetail",
        data
    })
}



/** 文件上传 */
export function UploadFile(data = {}){
    return request({
        method: "post",
        url: "/upload",
        data
    })
}